var comment = {
	//成功弹出
	success:function(msg,url){
		layer.msg(msg,{icon:6,time:2000,anim:5},function(){
			window.location.href=url;
		});
	},
	//错误提示
	tips:function(msg,attrname,follow,bgcolor,color){
        follow = arguments[2]?arguments[2]:2;
        bgcolor = arguments[3]?arguments[3]:'#f3c19a';
        color = arguments[4]?arguments[4]:'#fff';
		layer.tips(msg, attrname ,{tips:[follow,bgcolor,color]});
	},
	//错误弹出
	error:function(msg){
		layer.msg(msg,{icon:5,time:1000,anim:6});
	},
	//改变状态
	status:function(url,id,objectState){
		$.post(url,{id:id},
            function(data){
                if(data.status < 1){
                    alert(data.mess);
                }else{
                    if(1 == data.data){
                        objectState.removeClass('label-danger').addClass('label-primary').html('正常');
                    }else{
                        objectState.removeClass('label-primary').addClass('label-danger').html('禁用');
                    }
                }
            },'json');
	},
    del:function (url,id,gotoUrl) {
        layer.msg('你确定要删除吗？', {
            time: 0 //不自动关闭
            ,btn: ['火速删除', '我再想想']
            ,yes: function(index){
                $.post(url,{id:id},function(data){
                    if(data.status < 1){
                        comment.error(data.mess);
                    }else{
                        comment.success(data.mess,gotoUrl);
                    }
                },'json');
            }
        });
    }
	


}